const jokeEl = document.getElementById('joke')
const jokeBtn = document.getElementById('jokeBtn')
// 点击事件时出发函数getjoke函数，这个形式，不用加括号
jokeBtn.addEventListener('click',getjoke)
getjoke()

async function getjoke(params) {
  const config = {
    headers:{
      Accept:'application/json',
    }
  }



  const res = await fetch('https://icanhazdadjoke.com',config)
  const data = await res.json()
  console.log(data)
  jokeEl.innerHTML = data.joke
  }